<template>
  <div class="box7">
    <div class="title">
      <p>年度游客量对比</p>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div class="echarts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
let charts = ref()
onMounted(() => {
  let mycharts = echarts.init(charts.value)
  mycharts.setOption({
    title: {
      text: '散点图',
      left: '40%',
      textStyle: {
        color: 'yellowgreen',
      },
    },
    xAxis: {
      type: 'category',
    },
    yAxis: { show: false },
    grid: {
      top: 38,
      left: 20,
      bottom: 20,
    },
    series: {
      type: 'scatter', //散点图
      data: [5, 23, 56, 678, 34, 434, 45, 67, 36, 345, 34, 545],
      symbol: 'diamond', //散点标记的图形
      label: {
        show: true,
        position: 'top',
        fontSize: 15,
        color: 'yellowgreen',
      },
      //图形的样式
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: '#8882A1', // 0% 处的颜色
            },
            {
              offset: 1,
              color: '#F6F6F6', // 100% 处的颜色
            },
          ],
        },
      },
    },
  })
})
</script>

<style scoped lang="scss">
.box7 {
  width: 100%;
  height: 100%;
  margin: 20px 0;
  background: url('../../images/dataScreen-main-cb.png') no-repeat;
  background-size: 100% 100%;
  .title {
    p {
      color: white;
      font-size: 17px;
    }
  }
  .echarts {
    height: 100%;
    width: 100%;
  }
}
</style>
